setwd()

##Figure 1: Marginal Effects of Congress-Court Distance on the Probability of Review, at varying levels of President-Congress Distance##

data<-read.csv("figure 1_marginal effects_dist.csv", header = T)
attach(data)

par(mar=c(4.8, 4.8, 2.1, 2.1))
plot(dist_pc, dydx_cc1, xlab = "D(Current President, Current Congress)", ylab = "Effects on Probability of Review", type = "l", lwd = 3, ylim = c(min(lo90_cc1), max(hi90_cc1)))
polygon(c(dist_pc, rev(dist_pc)), c(lo90_cc1, rev(hi90_cc1)), col = rgb(0.5, 0.5, 0.5, 0.5), border = NA)
lines(dist_pc, dydx_cc1, lwd = 3)
abline(h = 0)


##Figure 2: Marginal Effects of President-Court Distance on the Probability of Review, at varying levels of Salience##

data<-read.csv("figure 2_marginal effects_salience.csv", header = T)
attach(data)

par(mfrow=c(1,2))
plot(1:2, dydx_pcourt_mip_align, main = "(a)", 
	xaxt = "n", ylim = c(min(lo90_pcourt_mip_align), max(hi90_pcourt_mip_align)), xlim = c(0.5, 2.5), 
	xlab = "",
	ylab = "Effect on the Probability of Review", pch = 16, cex = 2)
abline(h = dydx_pcourt_mip_align[1], lty = 2, lwd = 3)
for (i in 1:2){
	lines(c(i, i), c(lo90_pcourt_mip_align[i], hi90_pcourt_mip_align[i]), lwd = 2)
}
axis(1, labels = c("Low Public Salience",
	"High Public Salience"), at = 1:2, tick = F)
plot(1:2, dydx_pcourt_mip_noalign, main = "(b)", 
	xaxt = "n", ylim = c(min(lo90_pcourt_mip_noalign), max(hi90_pcourt_mip_noalign)), xlim = c(0.5, 2.5), 
	xlab = "",
	ylab = "Effect on the Probability of Review", pch = 16, cex = 2)
abline(h = dydx_pcourt_mip_noalign[1], lty = 2, lwd = 3)
for (i in 1:2){
	lines(c(i, i), c(lo90_pcourt_mip_noalign[i], hi90_pcourt_mip_noalign[i]), lwd = 2)
}
axis(1, labels = c("Low Public Salience",
	"High Public Salience"), at = 1:2, tick = F)
	
	
##Figure 3: Marginal Effects of President-Court Distance on the Probability of Review, at varying levels of Agency Independence##

data<-read.csv("figure 3_marginal effects_independence.csv", header = T)
attach(data)

#tiff(file="Figure3.tiff")
par(mar=c(4.8, 4.8, 2.1, 2.1))
plot(dist_pc, dydx_dim2, xlab = "Policy Decision Independence", ylab = "Effects on the Probability of Review", type = "l", lwd = 3, ylim = c(min(lo90_dim2), max(hi90_dim2)))
polygon(c(dist_pc, rev(dist_pc)), c(lo90_dim2, rev(hi90_dim2)), col = rgb(0.5, 0.5, 0.5, 0.5), border = NA)
lines(dist_pc, dydx_dim2, lwd = 3)
abline(h = 0)
#dev.off()
